<div id="update-details">
<fieldset>
<legend>Update Your Details</legend>
<?php
/*
+--------------------------------------------------------------------------
|   AffiliStore 2
|   ========================================
|   Web: http://www.affilistore.com
|   Email: admin (at) affilistore (dot) com
|	License Type: AffiliStore 2 is NOT open source software and limitations apply 
|   Licence Info: Visit AffiliStore website and click on 'Licence'
+--------------------------------------------------------------------------
*/
// checks to see if password session is set
// if not redirects to ../admin/

include_once '../includes/models/Account.php';
include_once '../includes/models/Auth.php';
include_once 'includes/forms/RegisterForm1.php';

$form1 = new RegisterForm1();
$account = new Account();
$authenticate = new Auth();

if(isset($_POST['accTitle']))
{
	if($form1->isValid($_POST)) //succeed
	{
		$dataForm1 = $form1->getValues(); 
		unset($dataForm1['button']);
		if ($account->edit($dataForm1,$authenticate->getIdentity()))
		{
			echo '<div class="success">Update sucessfully.</div>';
			$form1->populate($account->get($authenticate->getIdentity()));	//get by username
		}
		else 
		{
			echo '<div class="errors">Update failed.</div>';
			$form1->populate($_POST);	//get by username
		}
	}
	else 
	{
		$form1->populate($_POST);
	}
}
else 
{
	$form1->populate($account->get($authenticate->getIdentity()));	//get by username
}
echo $form1->render();


?>
</fieldset>
</div>